<template>
  <div>
    <!-- 事件对象e可以直接使用 -->
     <button @click="fn">按钮一</button> <br>  <br>
     <button @click="fn1(2,$event)">按钮二</button>
      <br> <br>
      <!-- 反正默认跳转 -->
     <a :href="url" @click.prevent="fn2">百度一下</a>
     <form action="">
      <input type="text">
      <button @click.prevent.stop="fn3">提交</button>
     </form>
      <!-- 判断用户是否按了回车 -->
        <input type="text" @keyup.enter="keyUp">
       
   </div>
</template>
 
<script>
export default {
  
  data() {
    return {
      url:'http://www.baidu.com'
    };
  },
 
  methods: {
    fn(e){
   console.log(e.target);
    },
    fn1(a,e){
  console.log(a);
  console.log(e);
  
    },
    fn2(){

    },
    fn3(){

    },
    keyUp(){
    console.log('1');
    }
  }
};
</script>

<style scoped>
     
</style>